<?php
// +----------------------------------------------------------------------
// | @filename AssignPermissionsRequest.php
// +----------------------------------------------------------------------
// | @author 落花轻舞问君愁 <mwcx1990@qq.com>
// +----------------------------------------------------------------------
// | @datetime 2021-11-01 17:00:21
// +----------------------------------------------------------------------
// | @Description
// +----------------------------------------------------------------------

namespace Addons\Backend\Http\Requests\Role;


use Addons\Backend\Http\Requests\BaseRequest;

class AssignPermissionsRequest extends BaseRequest
{
    public function rules(): array
    {
        return [
            'id' => ['bail', 'required', 'exists:roles,id'],
            'permissions' => ['bail', 'array'],
        ];
    }

    public function messages(): array
    {
        return [
            'id.exists' => '角色不存在',
            'permissions.array' => '权限必须是个数组',
        ];
    }

    public function authorize(): bool
    {
        return true;
    }
}
